package com.qianfeng.email;

import java.io.File;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class EmailController {

	@Autowired
	private EmailService emailService;
	
	@RequestMapping("/simple")
	@ResponseBody
	public String sendSimpleEmail() {
		emailService.sendSimpleMail("2585196949@qq.com", "你好", "明天去钓鱼");
		return "发送简单邮件成功";
	}
	
	@RequestMapping("/attach")
	@ResponseBody
    public String sendAttachMentEmail() {
		File file = new File("src/main/resources/static/66.txt");
		emailService.sendAttachmentMail("2585196949@qq.com", "你好", "明天去钓鱼",file);
		return "发送带附件的邮件成功";
	}
	
	@RequestMapping("/template")
	@ResponseBody
    public String sendTemplateEamil() {
		
		emailService.sendTemplateMail("2585196949@qq.com", "发送模板邮件","info.html");
		return "发送带附件的邮件成功";
	}
}






















